import 'package:flutter/cupertino.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class WebDetailsContentPage extends StatefulWidget {
   String url='';
   WebDetailsContentPage({this.url='', Key? key}) : super(key: key);

  @override
  State<WebDetailsContentPage> createState() => _WebDetailsContentPageState();
}

class _WebDetailsContentPageState extends State<WebDetailsContentPage> {
  String headUrl ='<head><meta name="viewport" content="width=device-width, initial-scale=1.0"></head>';
  InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
    crossPlatform: InAppWebViewOptions(
      useShouldOverrideUrlLoading: true,
      mediaPlaybackRequiresUserGesture: false,
    ),

    /// android 支持HybridComposition
    android: AndroidInAppWebViewOptions(
      useHybridComposition: true,
        overScrollMode:AndroidOverScrollMode.OVER_SCROLL_NEVER
    ),
    ios: IOSInAppWebViewOptions(
      allowsInlineMediaPlayback: true,
    ),
  );
  @override
  Widget build(BuildContext context) {
    return InAppWebView(
      initialData: InAppWebViewInitialData(data:headUrl+ widget.url),
      initialOptions: options,
    );
  }
}
